<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Test2::Transition - Transition notes when upgrading to Test2 - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Test2::Transition">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::Transition.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Test2::Transition">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Test2::Transition">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Test2::Transition">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Test2::Transition">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Test2::Transition">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Test2::Transition">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Test2::Transition">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Test2::Transition">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Test2::Transition">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Test2::Transition">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Test2::Transition">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Test2::Transition">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Test2::Transition">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Test2::Transition">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Test2::Transition">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Test2::Transition">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Test2::Transition">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Test2::Transition">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Test2::Transition">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Test2::Transition">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Test2::Transition">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Test2::Transition">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Test2::Transition">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Test2::Transition">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Test2::Transition">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Test2::Transition">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Test2::Transition">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Test2::Transition">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Test2::Transition">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Test2::Transition">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Test2::Transition">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Test2::Transition">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Test2::Transition">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Test2::Transition">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Test2::Transition">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Test2::Transition">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Test2::Transition">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Test2::Transition">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Test2::Transition">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Test2::Transition">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Test2::Transition">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Test2::Transition">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Test2::Transition">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Test2::Transition">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Test2::Transition">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Test2::Transition">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Test2::Transition">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Test2::Transition">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Test2::Transition">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Test2::Transition">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Test2::Transition">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Test2::Transition">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Test2::Transition">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Test2::Transition">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Test2::Transition">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Test2::Transition">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Test2::Transition">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Test2::Transition">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Test2::Transition">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Test2::Transition">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Test2::Transition">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Test2::Transition">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Test2::Transition">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Test2::Transition">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Test2::Transition">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Test2::Transition">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Test2::Transition">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Test2::Transition">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Test2::Transition">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Test2::Transition">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Test2::Transition">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Test2::Transition">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Test2::Transition">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Test2::Transition">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Test2::Transition">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Test2::Transition">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Test2::Transition">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Test2::Transition">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Test2::Transition">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Test2::Transition">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::Transition.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Test2::Transition">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Test2::Transition">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Test2::Transition">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Test2::Transition">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Test2::Transition">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Test2::Transition">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Test2::Transition">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Test2::Transition">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Test2::Transition">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Test2::Transition">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Test2::Transition">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Test2::Transition">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Test2::Transition">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Test2::Transition">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Test2::Transition">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Test2::Transition">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Test2::Transition">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Test2::Transition">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Test2::Transition">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Test2::Transition">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Test2::Transition">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Test2::Transition">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Test2::Transition">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Test2::Transition">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Test2::Transition">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Test2::Transition">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Test2::Transition">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Test2::Transition">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Test2::Transition">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Test2::Transition">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Test2::Transition">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Test2::Transition">5.35.1</a>
          <a class="dropdown-item active" href="./Test2::Transition.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Test2::Transition.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Test2::Transition.html">Test2::Transition</a>
          <div id="more">
            (<a href="./Test2::Transition.txt">source</a>,
            <a href="https://metacpan.org/pod/Test2::Transition">CPAN</a>)
          </div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#THINGS-THAT-BREAK">THINGS THAT BREAK</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#Test::Builder1.5/2-conditionals">Test::Builder1.5/2 conditionals</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Problem">The Problem</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Fix">The Fix</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#Replacing-the-Test::Builder-singleton">Replacing the Test::Builder singleton</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Problem1">The Problem</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Fix1">The Fix</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#Directly-Accessing-Hash-Elements">Directly Accessing Hash Elements</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Problem2">The Problem</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Fix2">The Fix</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#Subtest-indentation">Subtest indentation</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Problem3">The Problem</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#The-Fix3">The Fix</a>
              </li>
          </ul>

              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#DISTRIBUTIONS-THAT-BREAK-OR-NEED-TO-BE-UPGRADED">DISTRIBUTIONS THAT BREAK OR NEED TO BE UPGRADED</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#WORKS-BUT-TESTS-WILL-FAIL">WORKS BUT TESTS WILL FAIL</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#UPGRADE-SUGGESTED">UPGRADE SUGGESTED</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#NEED-TO-UPGRADE">NEED TO UPGRADE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#STILL-BROKEN">STILL BROKEN</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#MAKE-ASSERTIONS-%3E-SEND-EVENTS">MAKE ASSERTIONS -&gt; SEND EVENTS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#LEGACY">LEGACY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#TEST2">TEST2</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#WRAP-EXISTING-TOOLS">WRAP EXISTING TOOLS</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#LEGACY1">LEGACY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#TEST21">TEST2</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#USING-UTF8">USING UTF8</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#LEGACY2">LEGACY</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#TEST22">TEST2</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#AUTHORS,-CONTRIBUTORS-AND-REVIEWERS">AUTHORS, CONTRIBUTORS AND REVIEWERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#SOURCE">SOURCE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#MAINTAINER">MAINTAINER</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Test2::Transition.html#COPYRIGHT">COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Test2::Transition.html#NAME">#</a>NAME</h1>

<p>Test2::Transition - Transition notes when upgrading to Test2</p>

<h1 id="DESCRIPTION"><a class="permalink" href="./Test2::Transition.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>This is where gotchas and breakages related to the Test2 upgrade are documented. The upgrade causes Test::Builder to defer to Test2 under the hood. This transition is mostly transparent, but there are a few cases that can trip you up.</p>

<h1 id="THINGS-THAT-BREAK"><a class="permalink" href="./Test2::Transition.html#THINGS-THAT-BREAK">#</a><a id="THINGS"></a>THINGS THAT BREAK</h1>

<p>This is the list of scenarios that break with the new internals.</p>

<h2 id="Test::Builder1.5/2-conditionals"><a class="permalink" href="./Test2::Transition.html#Test::Builder1.5/2-conditionals">#</a><a id="Test"></a><a id="Test::Builder1.5-2-conditionals"></a>Test::Builder1.5/2 conditionals</h2>

<h3 id="The-Problem"><a class="permalink" href="./Test2::Transition.html#The-Problem">#</a><a id="The"></a>The Problem</h3>

<p>a few years back there were two attempts to upgrade/replace Test::Builder. Confusingly these were called Test::Builder2 and Test::Builder1.5, in that order. Many people put conditionals in their code to check the Test::Builder version number and adapt their code accordingly.</p>

<p>The Test::Builder2/1.5 projects both died out. Now the conditional code people added has become a mine field. A vast majority of modules broken by Test2 fall into this category.</p>

<h3 id="The-Fix"><a class="permalink" href="./Test2::Transition.html#The-Fix">#</a><a id="The1"></a>The Fix</h3>

<p>The fix is to remove all Test::Builder1.5/2 related code. Either use the legacy Test::Builder API, or use Test2 directly.</p>

<h2 id="Replacing-the-Test::Builder-singleton"><a class="permalink" href="./Test2::Transition.html#Replacing-the-Test::Builder-singleton">#</a><a id="Replacing"></a>Replacing the Test::Builder singleton</h2>

<h3 id="The-Problem1"><a class="permalink" href="./Test2::Transition.html#The-Problem1">#</a><a id="The2"></a>The Problem</h3>

<p>Some test modules would replace the Test::Builder singleton instance with their own instance or subclass. This was usually done to intercept or modify results as they happened.</p>

<p>The Test::Builder singleton is now a simple compatibility wrapper around Test2. The Test::Builder singleton is no longer the central place for results. Many results bypass the Test::Builder singleton completely, which breaks and behavior intended when replacing the singleton.</p>

<h3 id="The-Fix1"><a class="permalink" href="./Test2::Transition.html#The-Fix1">#</a><a id="The3"></a>The Fix</h3>

<p>If you simply want to intercept all results instead of letting them go to TAP, you should look at the <a href="./Test2::API.html">Test2::API</a> docs and read about pushing a new hub onto the hub stack. Replacing the hub temporarily is now the correct way to intercept results.</p>

<p>If your goal is purely monitoring of events use the <code>Test2::Hub-&gt;listen()</code> method exported by Test::More to watch events as they are fired. If you wish to modify results before they go to TAP look at the <code>Test2::Hub-&gt;filter()</code> method.</p>

<h2 id="Directly-Accessing-Hash-Elements"><a class="permalink" href="./Test2::Transition.html#Directly-Accessing-Hash-Elements">#</a><a id="Directly"></a>Directly Accessing Hash Elements</h2>

<h3 id="The-Problem2"><a class="permalink" href="./Test2::Transition.html#The-Problem2">#</a><a id="The4"></a>The Problem</h3>

<p>Some modules look directly at hash keys on the Test::Builder singleton. The problem here is that the Test::Builder singleton no longer holds anything important.</p>

<h3 id="The-Fix2"><a class="permalink" href="./Test2::Transition.html#The-Fix2">#</a><a id="The5"></a>The Fix</h3>

<p>The fix is to use the API specified in <a href="./Test2::API.html">Test2::API</a> to look at or modify state as needed.</p>

<h2 id="Subtest-indentation"><a class="permalink" href="./Test2::Transition.html#Subtest-indentation">#</a><a id="Subtest"></a>Subtest indentation</h2>

<h3 id="The-Problem3"><a class="permalink" href="./Test2::Transition.html#The-Problem3">#</a><a id="The6"></a>The Problem</h3>

<p>An early change, in fact the change that made Test2 an idea, was a change to the indentation of the subtest note. It was decided it would be more readable to outdent the subtest note instead of having it inline with the subtest:</p>

<pre><code class="plaintext"># subtest foo
    ok 1 - blah
    1..1
ok 1 - subtest foo</code></pre>

<p>The old style indented the note:</p>

<pre><code class="plaintext">    # subtest foo
    ok 1 - blah
    1..1
ok 1 - subtest foo</code></pre>

<p>This breaks tests that do string comparison of TAP output.</p>

<h3 id="The-Fix3"><a class="permalink" href="./Test2::Transition.html#The-Fix3">#</a><a id="The7"></a>The Fix</h3>

<pre><code>my $indent = $INC{&#39;Test2/API.pm&#39;} ? &#39;&#39; : &#39;    &#39;;

is(
    $subtest_output,
    &quot;${indent}# subtest foo&quot;,
    &quot;Got subtest note&quot;
);</code></pre>

<p>Check if <code>$INC{&#39;Test2/API.pm&#39;}</code> is set, if it is then no indentation should be expected. If it is not set, then the old Test::Builder is in use, indentation should be expected.</p>

<h1 id="DISTRIBUTIONS-THAT-BREAK-OR-NEED-TO-BE-UPGRADED"><a class="permalink" href="./Test2::Transition.html#DISTRIBUTIONS-THAT-BREAK-OR-NEED-TO-BE-UPGRADED">#</a><a id="DISTRIBUTIONS"></a>DISTRIBUTIONS THAT BREAK OR NEED TO BE UPGRADED</h1>

<p>This is a list of cpan modules that have been known to have been broken by the upgrade at one point.</p>

<h2 id="WORKS-BUT-TESTS-WILL-FAIL"><a class="permalink" href="./Test2::Transition.html#WORKS-BUT-TESTS-WILL-FAIL">#</a><a id="WORKS"></a>WORKS BUT TESTS WILL FAIL</h2>

<p>These modules still function correctly, but their test suites will not pass. If you already have these modules installed then you can continue to use them. If you are trying to install them after upgrading Test::Builder you will need to force installation, or bypass the broken tests.</p>

<dl>

<dt id="Test::DBIx::Class::Schema"><a class="permalink" href="./Test2::Transition.html#Test::DBIx::Class::Schema">#</a><a id="Test1"></a>Test::DBIx::Class::Schema</dt>
<dd>

<p>This module has a test that appears to work around a Test::Builder bug. The bug appears to have been fixed by Test2, which means the workaround causes a failure. This can be easily updated, but nobody has done so yet.</p>

<p>Known broken in versions: 1.0.9 and older</p>

</dd>
<dt id="Device::Chip"><a class="permalink" href="./Test2::Transition.html#Device::Chip">#</a><a id="Device"></a>Device::Chip</dt>
<dd>

<p>Tests break due to subtest indentation.</p>

<p>Known broken in version 0.07. Apparently works fine in 0.06 though. Patch has been submitted to fix the issue.</p>

</dd>
</dl>

<h2 id="UPGRADE-SUGGESTED"><a class="permalink" href="./Test2::Transition.html#UPGRADE-SUGGESTED">#</a><a id="UPGRADE"></a>UPGRADE SUGGESTED</h2>

<p>These are modules that did not break, but had broken test suites that have since been fixed.</p>

<dl>

<dt id="Test::Exception"><a class="permalink" href="./Test2::Transition.html#Test::Exception">#</a><a id="Test2"></a>Test::Exception</dt>
<dd>

<p>Old versions work fine, but have a minor test name behavior that breaks with Test2. Old versions will no longer install because of this. The latest version on CPAN will install just fine. Upgrading is not required, but is recommended.</p>

<p>Fixed in version: 0.43</p>

</dd>
<dt id="Data::Peek"><a class="permalink" href="./Test2::Transition.html#Data::Peek">#</a><a id="Data"></a>Data::Peek</dt>
<dd>

<p>Some tests depended on <code>$!</code> and <code>$?</code> being modified in subtle ways. A patch was applied to correct things that changed.</p>

<p>The module itself works fine, there is no need to upgrade.</p>

<p>Fixed in version: 0.45</p>

</dd>
<dt id="circular::require"><a class="permalink" href="./Test2::Transition.html#circular::require">#</a><a id="circular"></a>circular::require</dt>
<dd>

<p>Some tests were fragile and required base.pm to be loaded at a late stage. Test2 was loading base.pm too early. The tests were updated to fix this.</p>

<p>The module itself never broke, you do not need to upgrade.</p>

<p>Fixed in version: 0.12</p>

</dd>
<dt id="Test::Module::Used"><a class="permalink" href="./Test2::Transition.html#Test::Module::Used">#</a><a id="Test3"></a>Test::Module::Used</dt>
<dd>

<p>A test worked around a now-fixed planning bug. There is no need to upgrade if you have an old version installed. New versions install fine if you want them.</p>

<p>Fixed in version: 0.2.5</p>

</dd>
<dt id="Test::Moose::More"><a class="permalink" href="./Test2::Transition.html#Test::Moose::More">#</a><a id="Test4"></a>Test::Moose::More</dt>
<dd>

<p>Some tests were fragile, but have been fixed. The actual breakage was from the subtest comment indentation change.</p>

<p>No need to upgrade, old versions work fine. Only new versions will install.</p>

<p>Fixed in version: 0.025</p>

</dd>
<dt id="Test::FITesque"><a class="permalink" href="./Test2::Transition.html#Test::FITesque">#</a><a id="Test5"></a>Test::FITesque</dt>
<dd>

<p>This was broken by a bugfix to how planning is done. The test was updated after the bugfix.</p>

<p>Fixed in version: 0.04</p>

</dd>
<dt id="Test::Kit"><a class="permalink" href="./Test2::Transition.html#Test::Kit">#</a><a id="Test6"></a>Test::Kit</dt>
<dd>

<p>Old versions work fine, but would not install because <a href="./Test::Aggregate.html">Test::Aggregate</a> was in the dependency chain. An upgrade should not be needed.</p>

<p>Fixed in version: 2.15</p>

</dd>
<dt id="autouse"><a class="permalink" href="./Test2::Transition.html#autouse">#</a>autouse</dt>
<dd>

<p>A test broke because it depended on Scalar::Util not being loaded. Test2 loads Scalar::Util. The test was updated to load Test2 after checking Scalar::Util&#39;s load status.</p>

<p>There is no need to upgrade if you already have it installed.</p>

<p>Fixed in version: 1.11</p>

</dd>
</dl>

<h2 id="NEED-TO-UPGRADE"><a class="permalink" href="./Test2::Transition.html#NEED-TO-UPGRADE">#</a><a id="NEED"></a>NEED TO UPGRADE</h2>

<dl>

<dt id="Test::SharedFork"><a class="permalink" href="./Test2::Transition.html#Test::SharedFork">#</a><a id="Test7"></a>Test::SharedFork</dt>
<dd>

<p>Old versions need to directly access Test::Builder singleton hash elements. The latest version on CPAN will still do this on old Test::Builder, but will defer to <a href="./Test2::IPC.html">Test2::IPC</a> on Test2.</p>

<p>Fixed in version: 0.35</p>

</dd>
<dt id="Test::Builder::Clutch"><a class="permalink" href="./Test2::Transition.html#Test::Builder::Clutch">#</a><a id="Test8"></a>Test::Builder::Clutch</dt>
<dd>

<p>This works by doing overriding methods on the singleton, and directly accessing hash values on the singleton. A new version has been released that uses the Test2 API to accomplish the same result in a saner way.</p>

<p>Fixed in version: 0.07</p>

</dd>
<dt id="Test::Dist::VersionSync"><a class="permalink" href="./Test2::Transition.html#Test::Dist::VersionSync">#</a><a id="Test9"></a>Test::Dist::VersionSync</dt>
<dd>

<p>This had Test::Builder2 conditionals. This was fixed by removing the conditionals.</p>

<p>Fixed in version: 1.1.4</p>

</dd>
<dt id="Test::Modern"><a class="permalink" href="./Test2::Transition.html#Test::Modern">#</a><a id="Test10"></a>Test::Modern</dt>
<dd>

<p>This relied on <code>Test::Builder-&gt;_try()</code> which was a private method, documented as something nobody should use. This was fixed by using a different tool.</p>

<p>Fixed in version: 0.012</p>

</dd>
<dt id="Test::UseAllModules"><a class="permalink" href="./Test2::Transition.html#Test::UseAllModules">#</a><a id="Test11"></a>Test::UseAllModules</dt>
<dd>

<p>Version 0.14 relied on <code>Test::Builder-&gt;history</code> which was available in Test::Builder 1.5. Versions 0.12 and 0.13 relied on other Test::Builder internals.</p>

<p>Fixed in version: 0.15</p>

</dd>
<dt id="Test::More::Prefix"><a class="permalink" href="./Test2::Transition.html#Test::More::Prefix">#</a><a id="Test12"></a>Test::More::Prefix</dt>
<dd>

<p>Worked by applying a role that wrapped <code>Test::Builder-&gt;_print_comment</code>. Fixed by adding an event filter that modifies the message instead when running under Test2.</p>

<p>Fixed in version: 0.007</p>

</dd>
</dl>

<h2 id="STILL-BROKEN"><a class="permalink" href="./Test2::Transition.html#STILL-BROKEN">#</a><a id="STILL"></a>STILL BROKEN</h2>

<dl>

<dt id="Test::Aggregate"><a class="permalink" href="./Test2::Transition.html#Test::Aggregate">#</a><a id="Test13"></a>Test::Aggregate</dt>
<dd>

<p>This distribution directly accesses the hash keys in the <a href="./Test::Builder.html">Test::Builder</a> singleton. It also approaches the problem from the wrong angle, please consider using <a href="./Test2::Aggregate.html">Test2::Aggregate</a> for similar functionality and <a href="./Test2::Harness.html">Test2::Harness</a> which allows module preloading at the harness level.</p>

<p>Still broken as of version: 0.373</p>

</dd>
<dt id="Test::Wrapper"><a class="permalink" href="./Test2::Transition.html#Test::Wrapper">#</a><a id="Test14"></a>Test::Wrapper</dt>
<dd>

<p>This module directly uses hash keys in the <a href="./Test::Builder.html">Test::Builder</a> singleton. This module is also obsolete thanks to the benefits of <a href="Test2.html">Test2</a>. Use <code>intercept()</code> from <a href="./Test2::API.html">Test2::API</a> to achieve a similar result.</p>

<p>Still broken as of version: 0.3.0</p>

</dd>
<dt id="Test::ParallelSubtest"><a class="permalink" href="./Test2::Transition.html#Test::ParallelSubtest">#</a><a id="Test15"></a>Test::ParallelSubtest</dt>
<dd>

<p>This module overrides <code>Test::Builder::subtest()</code> and <code>Test::Builder::done_testing()</code>. It also directly accesses hash elements of the singleton. It has not yet been fixed.</p>

<p>Alternatives: <a href="./Test2::AsyncSubtest.html">Test2::AsyncSubtest</a> and <a href="./Test2::Workflow.html">Test2::Workflow</a> (not stable).</p>

<p>Still broken as of version: 0.05</p>

</dd>
<dt id="Test::Pretty"><a class="permalink" href="./Test2::Transition.html#Test::Pretty">#</a><a id="Test16"></a>Test::Pretty</dt>
<dd>

<p>See https://github.com/tokuhirom/Test-Pretty/issues/25</p>

<p>The author admits the module is crazy, and he is awaiting a stable release of something new (Test2) to completely rewrite it in a sane way.</p>

<p>Still broken as of version: 0.32</p>

</dd>
<dt id="Net::BitTorrent"><a class="permalink" href="./Test2::Transition.html#Net::BitTorrent">#</a><a id="Net"></a>Net::BitTorrent</dt>
<dd>

<p>The tests for this module directly access <a href="./Test::Builder.html">Test::Builder</a> hash keys. Most, if not all of these hash keys have public API methods that could be used instead to avoid the problem.</p>

<p>Still broken in version: 0.052</p>

</dd>
<dt id="Test::Group"><a class="permalink" href="./Test2::Transition.html#Test::Group">#</a><a id="Test17"></a>Test::Group</dt>
<dd>

<p>It monkeypatches Test::Builder, and calls it &quot;black magic&quot; in the code.</p>

<p>Still broken as of version: 0.20</p>

</dd>
<dt id="Test::Flatten"><a class="permalink" href="./Test2::Transition.html#Test::Flatten">#</a><a id="Test18"></a>Test::Flatten</dt>
<dd>

<p>This modifies the Test::Builder internals in many ways. A better was to accomplish the goal of this module is to write your own subtest function.</p>

<p>Still broken as of version: 0.11</p>

</dd>
<dt id="Log::Dispatch::Config::TestLog"><a class="permalink" href="./Test2::Transition.html#Log::Dispatch::Config::TestLog">#</a><a id="Log"></a>Log::Dispatch::Config::TestLog</dt>
<dd>

<p>Modifies Test::Builder internals.</p>

<p>Still broken as of version: 0.02</p>

</dd>
<dt id="Test::Able"><a class="permalink" href="./Test2::Transition.html#Test::Able">#</a><a id="Test19"></a>Test::Able</dt>
<dd>

<p>Modifies Test::Builder internals.</p>

<p>Still broken as of version: 0.11</p>

</dd>
</dl>

<h1 id="MAKE-ASSERTIONS-&gt;-SEND-EVENTS"><a class="permalink" href="./Test2::Transition.html#MAKE-ASSERTIONS-%3E-SEND-EVENTS">#</a><a id="MAKE"></a><a id="MAKE-ASSERTIONS---SEND-EVENTS"></a>MAKE ASSERTIONS -&gt; SEND EVENTS</h1>

<h2 id="LEGACY"><a class="permalink" href="./Test2::Transition.html#LEGACY">#</a>LEGACY</h2>

<pre><code>use Test::Builder;

# A majority of tools out there do this:
# my $TB = Test::Builder-&gt;new;
# This works, but has always been wrong, forcing Test::Builder to implement
# subtests as a horrific hack. It also causes problems for tools that try
# to replace the singleton (also discouraged).

sub my_ok($;$) {
    my ($bool, $name) = @_;
    my $TB = Test::Builder-&gt;new;
    $TB-&gt;ok($bool, $name);
}

sub my_diag($) {
    my ($msg) = @_;
    my $TB = Test::Builder-&gt;new;
    $TB-&gt;diag($msg);
}</code></pre>

<h2 id="TEST2"><a class="permalink" href="./Test2::Transition.html#TEST2">#</a>TEST2</h2>

<pre><code>use Test2::API qw/context/;

sub my_ok($;$) {
    my ($bool, $name) = @_;
    my $ctx = context();
    $ctx-&gt;ok($bool, $name);
    $ctx-&gt;release;
}

sub my_diag($) {
    my ($msg) = @_;
    my $ctx = context();
    $ctx-&gt;diag($msg);
    $ctx-&gt;release;
}</code></pre>

<p>The context object has API compatible implementations of the following methods:</p>

<dl>

<dt id="ok($bool,-$name)"><a class="permalink" href="./Test2::Transition.html#ok($bool,-$name)">#</a><a id="ok"></a><a id="ok-bool-name"></a>ok($bool, $name)</dt>
<dd>

</dd>
<dt id="diag(@messages)"><a class="permalink" href="./Test2::Transition.html#diag(@messages)">#</a><a id="diag"></a><a id="diag-messages"></a>diag(@messages)</dt>
<dd>

</dd>
<dt id="note(@messages)"><a class="permalink" href="./Test2::Transition.html#note(@messages)">#</a><a id="note"></a><a id="note-messages"></a>note(@messages)</dt>
<dd>

</dd>
<dt id="subtest($name,-$code)"><a class="permalink" href="./Test2::Transition.html#subtest($name,-$code)">#</a><a id="subtest"></a><a id="subtest-name-code"></a>subtest($name, $code)</dt>
<dd>

</dd>
</dl>

<p>If you are looking for helpers with <code>is</code>, <code>like</code>, and others, see <a href="./Test2::Suite.html">Test2::Suite</a>.</p>

<h1 id="WRAP-EXISTING-TOOLS"><a class="permalink" href="./Test2::Transition.html#WRAP-EXISTING-TOOLS">#</a><a id="WRAP"></a>WRAP EXISTING TOOLS</h1>

<h2 id="LEGACY1"><a class="permalink" href="./Test2::Transition.html#LEGACY1">#</a>LEGACY</h2>

<pre><code>use Test::More;

sub exclusive_ok {
    my ($bool1, $bool2, $name) = @_;

    # Ensure errors are reported 1 level higher
    local $Test::Builder::Level = $Test::Builder::Level + 1;

    $ok = $bool1 || $bool2;
    $ok &amp;&amp;= !($bool1 &amp;&amp; $bool2);
    ok($ok, $name);

    return $bool;
}</code></pre>

<p>Every single tool in the chain from this, to <code>ok</code>, to anything <code>ok</code> calls needs to increment the <code>$Level</code> variable. When an error occurs Test::Builder will do a trace to the stack frame determined by <code>$Level</code>, and report that file+line as the one where the error occurred. If you or any other tool you use forgets to set <code>$Level</code> then errors will be reported to the wrong place.</p>

<h2 id="TEST21"><a class="permalink" href="./Test2::Transition.html#TEST21">#</a>TEST2</h2>

<pre><code>use Test::More;

sub exclusive_ok {
    my ($bool1, $bool2, $name) = @_;

    # Grab and store the context, even if you do not need to use it
    # directly.
    my $ctx = context();

    $ok = $bool1 || $bool2;
    $ok &amp;&amp;= !($bool1 &amp;&amp; $bool2);
    ok($ok, $name);

    $ctx-&gt;release;
    return $bool;
}</code></pre>

<p>Instead of using <code>$Level</code> to perform a backtrace, Test2 uses a context object. In this sample you create a context object and store it. This locks the context (errors report 1 level up from here) for all wrapped tools to find. You do not need to use the context object, but you do need to store it in a variable. Once the sub ends the <code>$ctx</code> variable is destroyed which lets future tools find their own.</p>

<h1 id="USING-UTF8"><a class="permalink" href="./Test2::Transition.html#USING-UTF8">#</a><a id="USING"></a>USING UTF8</h1>

<h2 id="LEGACY2"><a class="permalink" href="./Test2::Transition.html#LEGACY2">#</a>LEGACY</h2>

<pre><code># Set the mode BEFORE anything loads Test::Builder
use open &#39;:std&#39;, &#39;:encoding(utf8)&#39;;
use Test::More;</code></pre>

<p>Or</p>

<pre><code># Modify the filehandles
my $builder = Test::More-&gt;builder;
binmode $builder-&gt;output,         &quot;:encoding(utf8)&quot;;
binmode $builder-&gt;failure_output, &quot;:encoding(utf8)&quot;;
binmode $builder-&gt;todo_output,    &quot;:encoding(utf8)&quot;;</code></pre>

<h2 id="TEST22"><a class="permalink" href="./Test2::Transition.html#TEST22">#</a>TEST2</h2>

<pre><code>use Test2::API qw/test2_stack/;

test2_stack-&gt;top-&gt;format-&gt;encoding(&#39;utf8&#39;);</code></pre>

<p>Though a much better way is to use the <a href="./Test2::Plugin::UTF8.html">Test2::Plugin::UTF8</a> plugin, which is part of <a href="./Test2::Suite.html">Test2::Suite</a>.</p>

<h1 id="AUTHORS,-CONTRIBUTORS-AND-REVIEWERS"><a class="permalink" href="./Test2::Transition.html#AUTHORS,-CONTRIBUTORS-AND-REVIEWERS">#</a><a id="AUTHORS"></a><a id="AUTHORS-CONTRIBUTORS-AND-REVIEWERS"></a>AUTHORS, CONTRIBUTORS AND REVIEWERS</h1>

<p>The following people have all contributed to this document in some way, even if only for review.</p>

<dl>

<dt id="Chad-Granum-(EXODIST)"><a class="permalink" href="./Test2::Transition.html#Chad-Granum-(EXODIST)">#</a><a id="Chad-Granum-(EXODIST)-&lt;exodist@cpan.org&gt;"></a><a id="Chad"></a><a id="Chad-Granum-EXODIST-exodist-cpan.org"></a>Chad Granum (EXODIST) &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="SOURCE"><a class="permalink" href="./Test2::Transition.html#SOURCE">#</a>SOURCE</h1>

<p>The source code repository for Test2 can be found at <i>http://github.com/Test-More/test-more/</i>.</p>

<h1 id="MAINTAINER"><a class="permalink" href="./Test2::Transition.html#MAINTAINER">#</a>MAINTAINER</h1>

<dl>

<dt id="Chad-Granum"><a class="permalink" href="./Test2::Transition.html#Chad-Granum">#</a><a id="Chad-Granum-&lt;exodist@cpan.org&gt;"></a><a id="Chad1"></a><a id="Chad-Granum-exodist-cpan.org"></a>Chad Granum &lt;exodist@cpan.org&gt;</dt>
<dd>

</dd>
</dl>

<h1 id="COPYRIGHT"><a class="permalink" href="./Test2::Transition.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>Copyright 2020 Chad Granum &lt;exodist@cpan.org&gt;.</p>

<p>This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.</p>

<p>See <i>http://www.perl.com/perl/misc/Artistic.html</i></p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
